package com.qk.management.mapper;

import com.qk.domain.user.UserDO;
import com.qk.dto.user.UserDTO;
import com.qk.entity.User;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select * from user where role_id = #{id}")
    List<User> selectByRoleId(Integer id);

     @Select("select * from user where username = #{username}")
    User selectByUsername(String username);

    void updateById(User user);

    @Select("select * from user where id = #{id}")

    User selectById(Integer id);

    void deleteBatch(List<Integer> ids);

    List<UserDO> selectByPage(UserDTO dto);

    void insert(User user);


    @Select("SELECT image FROM user " +
            "WHERE image IS NOT NULL AND image != '' " +
            "AND GREATEST(create_time, update_time) >= DATE_SUB(NOW(), INTERVAL 10 DAY)")
    List<String> selectRecentImages();


}
